a = 1000
num2 = []
while a:
    num2.append(a % 2)
    a //= 2
print('二进制是', end='')
print('%d' % num2[len(num2) - 1], end='')
for i in range(1, len(num2)):
    print(num2[len(num2) - 1 - i], end='')


a = 1000
num8 = []
while a:
    num8.append(a % 8)
    a //= 8
print('\n八进制是', end='')
print('%7d' % num8[len(num8) - 1], end='')
for i in range(1, len(num8)):
    print(num8[len(num8)-1-i], end='')

a = 1000
num16 = []
while a:
    if a % 16 >= 10:
        num16.append(chr(a % 16 - 10 + ord('A')))
    else:
        num16.append(a % 16)
    a //= 16
print('\n十六进制是', end='')
print('%6d' % num16[len(num16) - 1], end='')
for i in range(1, len(num16)):
    print(num16[len(num16) - 1 - i], end='')

